/**
 * 
 */
package com.ingesup.services;

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Before;
import org.junit.Test;

import com.ingesup.entities.Contact;
import com.ingesup.entities.LettreType;
import com.ingesup.entities.ListeDeDiffusion;

import flex.messaging.io.ArrayCollection;


/**
 * @author FDEJEAN
 *
 */
public class EmailServiceTest {

	
	private static EmailService service;
	private static Contact user;
	private static LettreType lettre;
	private static ListeDeDiffusion liste;
	
	@Before
	public void beforeTest() {
		service = new EmailServiceImpl();	
		
		user = new Contact();
		user.setNom("Florian DEJAN");
		user.setAdresseMail("florian.dejean@gmail.com");
		
		lettre = new LettreType();
		lettre.setTitle("Test");
		lettre.setContent("News letter test");
		
		liste = new ListeDeDiffusion();
		liste.setNom("listeDeTest");
		
		List<Contact> list = new ArrayCollection();
		list.add(user);
		liste.setListeDeContacts(list);
	}
	
	/**
	 * Test method for {@link com.ingesup.services.EmailServiceImpl#envoyerEmail(com.ingesup.entities.ListeDeDiffusion, com.ingesup.entities.LettreType)}.
	 */
	@Test
	public void testEnvoyerEmailListeDeDiffusionLettreType() {
		assertTrue(service.envoyerEmail(liste, lettre));
	}

	/**
	 * Test method for {@link com.ingesup.services.EmailServiceImpl#envoyerEmail(com.ingesup.entities.Contact, com.ingesup.entities.LettreType)}.
	 */
	@Test
	public void testEnvoyerEmailContactLettreType() {
		assertTrue(service.envoyerEmail(user, lettre));
	}
}
